<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org"
      xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity3" xmlns:head="http://www.w3.org/1999/html">
<head th:include="public/public_css::public_css ('进出存合并报表')" />

<body style="background-color: #f2f2f2;">
<div class="layui-fluid larry-wrapper">
    <div class="layui-card">
        <div class="layui-row layui-col-space30">
            <div class="layui-col-xs24">
                <form class="layui-form layui-card-header  layui-card-header-auto" id="searchForm">
                    <div class="layui-inline">
                        <label class="layui-form-label">选择时间</label>
                        <div class="layui-input-inline">
                            <input type="text" class="layui-input" id="sj" name="sj" />
                        </div>
                    </div>

                    <div class="layui-inline inline-search-btn">
                        <a class="layui-btn layui-btn-normal" data-type="reload" id="search_button">搜索</a>
                    </div>
                    <div class="layui-inline inline-reset-btn">
                        <button type="reset" class="layui-btn layui-btn-primary" style="background-color: #1e9fff;color: white;"><font>重置</font></button>
                    </div>
                   <!-- <input type="hidden" id="cjsj_start" name="cjsj_start">
                    <input type="hidden" id="cjsj_end" name="cjsj_end">
                    <input type="hidden" id="shsj_start" name="shsj_start">
                    <input type="hidden" id="shsj_end" name="shsj_end">-->
                </form>
                <!--顶部按钮展示区域 【 tpl-button 】 -->
                <div class="group-button tpl-button" id="toolbar"></div>
                <!--列表-->
                <section class="panel panel-padding layui-card-body" >
                    <div class="pro">
                        <table id="table"  class="table text-nowrap" style="word-break:break-all; word-wrap:break-word;"></table>
                    </div>
                </section>
            </div>
        </div>
    </div>
</div>

</body>


<div th:include="public/public_js::public_js"></div>
<div th:include="public/public_btn::public_btn"></div>
<style type="text/css">

</style>
<script th:inline="javascript">
    var functions = [[${functions}]];
    $(function () {
        console.info("32332")
        console.log("我来了！！ ");
        $(".moreBtn").on("click",function () {
            $(".moreSearch").toggle();
        })
    });

    //	回车查询
    document.onkeydown = function(event) {
        e = event ? event : (window.event ? window.event : null);
        if (e.keyCode == 13) {
            //执行的方法
            $('#search_button').click();
        }
    };
    layui.use(['list','layer','zzpUtils','jquery','laydate','tablebutton'],function () {

        var zzpUtils= layui.zzpUtils,
            $ = layui.jquery,
            laydate = layui.laydate;
        tablebtn = layui.tablebutton;
        tablebtn.buildOnClick({
            type: 1,
            temp: $("#function_tpl"),
            functions: functions.headBtn,
            row: null,
            event: {
                searchEvent: function(){
                    zzpUtils.refreshTable("#table");
                },
                /*导出*/
                exportEvent: function (data) {
                    var arr = [];
                    var $rows = $table.bootstrapTable('getSelections');
                    if ($rows.length > 0) {
                        arr = $.map($rows, function (row) {
                            return row.hpid;
                        })
                    }
                    /*
                     * 以下是将ids和对象拼接在一起
                     * */
                    var str = zzpUtils.getFormJson($("#searchForm"));
                    var object2 = Object.assign({ids: arr}, str);
                    /*将条件查询和ids传到后台*/
                    zzpUtils.outputXslx({
                        url: "/reports/getoutStock",
                        data: JSON.stringify(object2)
                    });
                }
            }
        });


        laydate.render({
            elem: '#sj',
            type: 'month',
          /*  done: function(value, date, endDate){
                var cjsj_start=value.toString().substring(0,value.toString().indexOf("~"));
                var cjsj_end=value.toString().substring(value.toString().indexOf("~")+1);
                $("#cjsj_start").val(Date.parse(new Date(cjsj_start)));
                $("#cjsj_end").val(Date.parse(new Date(cjsj_end)));

                /!*  alert(Date.parse(new Date($("#cjsj_start").val())));
                 alert("2018-8-1:"+Date.parse(new Date("2018-8-1")));
                 alert("2018-08-01:"+Date.parse(new Date("2018-08-01")));*!/

                console.log(value); //得到日期生成的值，如：2017-08-18
                console.log(date); //得到日期时间对象：{year: 2017, month: 8, date: 18, hours: 0, minutes: 0, seconds: 0}
                console.log(endDate); //得结束的日期时间对象，开启范围选择（range: true）才会返回。对象成员同上。
            }*/
        });




        laydate.render({
            elem: '#test5'
            ,theme: '#20a0ff'
        })
        var $table = zzpUtils.table({
            elem: '#table',
            isApi: true,
            pagination:true,
            url: '/reports/outStock',
            columns: [{
                field: '',
                checkbox: true
            },{
                field: 'zjck',
                title: '质检出库',
                align : 'center'
            },{
                field: 'zjrk',
                title: '质检入库',
                align : 'center'
            },{
                field: 'shsl',
                title: '收货数量',
                align : 'center'
            },{
                field: 'hpbh',
                title: '货品编号',
                align : 'center'
            },{
                field: 'hpmc',
                title: '货品名称',
                align : 'center'
            },{
                field: 'syjc',
                title: '上月结存',
                align : 'center'
            }, {
                field: 'byjc',
                title: '本月结存',
                align : 'center'
            }],
            queryParams: function () {//查询条件
                return  zzpUtils.getFormJson($("#searchForm"));
            },

        });




        $(".inline-search-btn").on('click',function () {
            zzpUtils.refreshTable("#table");
        });




    });
</script>
</html>